﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ThridGroup.ERP.DTO;
using ThridGroup.ERP.DTO.ProductionSystem;
using Volo.Abp.Application.Dtos;

namespace ThridGroup.ERP.ProductionSystem
{
    /// <summary>
    /// 生产派单服务接口
    /// </summary>
    public interface IOrderDispatchServices
    {
        /// <summary>
        /// 添加生产派单
        /// </summary>
        /// <param name="createOrderDispatchDto">生产派单创建DTO</param>
        /// <returns>返回受影响的行数</returns>
        Task<int> AddOrderDispatch(CreateOrderDispatchDto createOrderDispatchDto);
        
        /// <summary>
        /// 查询用户信息
        /// </summary>
        /// <param name="showUserDTO">用户查询参数DTO</param>
        /// <returns>返回用户DTO列表</returns>
        Task<List<UserDTO>> ShowUser(ShowUserDTO showUserDTO);

        /// <summary>
        /// 分页获取生产派单列表
        /// </summary>
        /// <param name="page">页码</param>
        /// <param name="limit">每页数量</param>
        /// <param name="taskName">任务名称（可选）</param>
        /// <param name="productionOrderCode">生产工单编号（可选）</param>
        /// <param name="processesName">工序名称（可选）</param>
        /// <returns>返回分页后的生产派单列表</returns>
        Task<PagedResultDto<OrderDispatchDtoListDto>> GetOrderDispatchList(int page, int limit, string taskName=null,string productionOrderCode = null ,string processesName=null);

        /// <summary>
        /// 批量删除生产派单
        /// </summary>
        /// <param name="ids">要删除的ID列表</param>
        /// <returns>受影响的行数</returns>
        Task<int> BatchDeleteAsync(List<int> ids);

        /// <summary>
        /// 根据ID列表批量获取生产派单详情（用于批量反填）
        /// </summary>
        /// <param name="ids">ID列表</param>
        /// <returns>生产派单详情列表</returns>
        Task<List<OrderDispatchDtoListDto>> GetByIdsAsync(List<int> ids);

        /// <summary>
        /// 批量更新生产派单
        /// </summary>
        /// <param name="dtos">要更新的生产派单DTO列表</param>
        /// <returns>受影响的行数</returns>
        Task<int> BatchUpdateAsync(List<CreateOrderDispatchDto> dtos);

        /// <summary>
        /// 根据ID获取生产派单详情（用于反填）
        /// </summary>
        /// <param name="id">生产派单ID</param>
        /// <returns>生产派单详情</returns>
        Task<OrderDispatchDtoListDto> GetByIdAsync(int id);

        /// <summary>
        /// 更新单个生产派单
        /// </summary>
        /// <param name="dto">要更新的生产派单DTO</param>
        /// <returns>受影响的行数</returns>
        Task<int> UpdateAsync(CreateOrderDispatchDto dto);

        /// <summary>
        /// 删除单个生产派单
        /// </summary>
        /// <param name="id">要删除的ID</param>
        /// <returns>受影响的行数</returns>
        Task<int> DeleteAsync(int id);
    }
}
